package com.theta.common.base.swagger.doc.core.thread;

import java.util.concurrent.TimeUnit;

import com.github.xiaoymin.knife4j.aggre.spring.configuration.Knife4jAggregationProperties;
import com.theta.common.base.swagger.doc.config.NacosExtendRepository;

public class SyncThread extends Thread {
	
	private NacosExtendRepository nacosRepository;
	private Knife4jAggregationProperties properties;
	
	public SyncThread(NacosExtendRepository nacosRepository,Knife4jAggregationProperties properties) {
		this.nacosRepository=nacosRepository;
		this.properties=properties;
	}
	

	@Override
	public void run() {
		while(true) {
			try {
				TimeUnit.SECONDS.sleep(10);
				nacosRepository.reloadNacosRepository(properties.getNacos());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

	}

}
